<template>
	<s-layout style="background-color: #ffffff" navbar="normal" onShareAppMessage tabbar="/pages/index/category"
	          title="分类">
		<view class="body">
			<!--搜索框-->
			<s-category-search-block @click="sheep.$router.go('/pages/index/categorySearch')"></s-category-search-block>

			<!--站点分类-->
			<s-category-platform-panel :platform-list="platformList"></s-category-platform-panel>

			<!--商品分类-->
      <s-category-block-panel :category-list="state.categoryList"></s-category-block-panel>
		</view>
  </s-layout>
</template>

<script setup>
import {reactive} from 'vue';
import {onLoad} from "@dcloudio/uni-app";
import sheep from "@/sheep";

// 隐藏原生tabBar
uni.hideTabBar();

const platformList = [
	{
		name: '煤炉',
		src: 'https://img.js.design/assets/img/65dac799a6ae216ade79b3e6.jpeg#bbe9dbde832b373b67e60cd85b6d271d',
		type: 0
	},
	{
		name: '乐天市场',
		src: 'https://img.js.design/assets/img/65dac88bbd39d3fe986b6b75.webp#47584638908644d60dd9b852f67b8ee8',
		type: 1
	},
	{
		name: '骏河屋',
		src: 'https://img.js.design/assets/img/65dac95e08fc72b241d60d7e.png#a853c38c8506cdea1e7205ef9ce5d14d',
		type: 2
	},
	{
		name: 'Amazon',
		src: 'https://img.js.design/assets/img/65dac848a6ae216ade79b7c4.png#6183dc6c52b393462ba471aa6061e923',
		type: 3
	},
]

const state = reactive({
  categoryList: []
});

onLoad(async () => {
  state.categoryList = await sheep.$api.order.channelList({type: 'category_map'});
})

</script>

<style lang="scss" scoped>
.body {
	padding: 5rpx;
}
</style>
